//
//  AppDelegate.h
//  Address-book📞
//
//  Created by Mars_ZXB on 16/8/6.
//  Copyright © 2016年 BAT3. All rights reserved.
//
#define WIDTH self.view.frame.size.width
#define HEIGHT self.view.frame.size.height

#import "VC3rdOfContactDetail.h"
#import "ModelOfContact.h"
#import "DetailView.h"
@interface VC3rdOfContactDetail ()


@end

@implementation VC3rdOfContactDetail

- (void)loadView {
    [super loadView];
    self.view1 = [[DetailView alloc]initWithFrame:[UIScreen mainScreen].bounds];
    self.view = self.view1;

}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    [self configNavi];
    [self createSubViews];
    // Do any additional setup after loading the view.

}

#pragma mark - 配置 Navi
- (void)configNavi {
    // 属性传值.
    self.navigationItem.title = self.modelOfDetail.name;
    

}

#pragma mark - 子视图赋值.
- (void)createSubViews {
    // 头像
    [self createImage];
    // 姓名
    [self createLabelOfName];
    // 性别
    [self createLabelOfGender];
    // 年龄
    [self createLabelOfAge];
    // 联系方式
    [self createLabelOfPhoneNumber];

}
/** 头像 */
- (void)createImage {
 
    self.view1.picOfPerson.image = self.modelOfDetail.image;
  
}
/** 姓名 */
- (void)createLabelOfName {

    if ([self.modelOfDetail.name isEqualToString:@"(null)"]) {
        self.view1.Name.text = @"姓名";
    }
    else {
        self.view1.Name.text = self.modelOfDetail.name;
    }

}
/** 性别 */
- (void)createLabelOfGender {

    if ([self.modelOfDetail.gender isEqualToString:@"(null)"]||[self.modelOfDetail.gender isEqualToString:@""]) {
        self.view1.Gender.text = @"性别";
    }
    else {
        self.view1.Gender.text = self.modelOfDetail.gender;
    }

}
/** 年龄 */
- (void)createLabelOfAge {

    if (self.modelOfDetail.age == 0) {
        self.view1.Age.text = @"年龄";
    }
    self.view1.Age.text = [NSString stringWithFormat:@"%ld", self.modelOfDetail.age];

}
/** 联系方式 */
- (void)createLabelOfPhoneNumber {

    if ([self.modelOfDetail.phoneNumber isEqualToString:@"(null)"]) {
        self.view1.PhoneNumber.text = @"联系方式";
    }
    else {
        self.view1.PhoneNumber.text = self.modelOfDetail.phoneNumber;
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
